package jmine.tec.web.wicket.component.report;

import jmine.tec.report.api.Report;

import org.apache.wicket.markup.html.panel.Panel;

/**
 * Panel inlined para rendererizar um {@link Report}
 * 
 * @author takeshi
 */
public class ReportTablePanel extends Panel {

    private Report report;

    public static final String REPORT_TABLE_COMPONENT_ID = "reportTable";

    private ReportTableMarkupBuilder builder;

    /**
     * Construtor.
     * 
     * @param id id
     */
    public ReportTablePanel(String id) {
        super(id);
    }

    /**
     * Construtor publico (duh)
     * 
     * @param id {@link String}
     * @param report {@link Report}
     */
    public ReportTablePanel(String id, Report report) {
        this(id);
        this.report = report;
        this.builder = this.getReportTableMarkupBuilder();
        this.add(this.builder.createInlineMarkup(REPORT_TABLE_COMPONENT_ID, report));
    }

    /**
     * @return the {@link ReportTableMarkupBuilder}
     */
    protected ReportTableMarkupBuilder getReportTableMarkupBuilder() {
        return new ReportTableMarkupBuilder();
    }

    /**
     * @param report the report to set
     */
    protected final void setReport(Report report) {
        this.report = report;
    }

    /**
     * @return the report
     */
    public final Report getReport() {
        return this.report;
    }

}
